<template>
    <div class="main">
        <div class="wrap" ref="mainBg" :style="{background:mianBgUrl}">
        	<div id="start_center" class="start-center">
        		<div style="text-align: center;">
        			<img :src="logoUrl" id="logo_spb">
        		</div>
        		<br>
	        	<div class="bg_images" ref="bg_images">
		            <div id="userLogin" class="bg_userLogin" @click="openMask('loginMenu','nobtn','账号密码登录',['330px','330px'])"></div>
		            <div id="userReg" class="bg_userReg"@click="openMask('registMenu','nobtn','快捷登录注册',['330px','390px'])"></div>
		            <div id="onTrial" class="bg_onTrial hide"></div>
		        </div>
		        <br>
        	</div>
        	<div id="start_bottom_img" class="start_bottom_img"
		         style="display:none;text-align: center;position: absolute;left: 0;right: 0;bottom: 6em;color: #fff;">
		        <img style="width:332px;" src="../../images/yxsj_startup_02.png"/>
		    </div>
		    <div class="start-foot" id="start_foot" v-show="showFoot">
		        <span lang="111">©2005-2019</span>
		        <a href="http://www.yingedu.com" target="_blank" rel="nofollow" class="softInfoHover">&nbsp;广西英腾教育科技股份有限公司</a>&nbsp;版权所有
		        &nbsp;备案信息:<a href="http://www.miibeian.gov.cn/" target="_blank" class="softInfoHover">桂ICP备09009842号-4</a>
		        <!--<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan style='display: none' id='cnzz_stat_icon_1253611738'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s23.cnzz.com/stat.php%3Fid%3D1253611738%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>-->
		    </div>
            <!-- 登录 -->
            <!--<loginMenu></loginMenu>-->
            <!-- 注册/重置密码 -->
            <!--<registMenu v-show="!showSubMenu" :isRegShow="isRegShow" :reType="registerType" ref="regChild" v-on:changeHidden="customHidden($event)" v-on:changeReg="changeShowSubMenu(0)"></registMenu>-->
            <!-- 注册/重置密码 -->
        </div>
        <dialog-bar v-model="sendVal" :width="showFlag.area[0]" :height="showFlag.area[1]" :type="showFlag.type" :title="showFlag.title" content="" v-on:cancel="clickCancel()" @danger="clickDanger()" @confirm="clickConfirm()" dangerText="Delete">
        	<loginMenu v-if="showFlag.module== 'loginMenu' " @openMask1="openswitchMenu" ></loginMenu>
        	<registMenu v-if="showFlag.module== 'registMenu' "></registMenu>
        </dialog-bar>
        <switchMenu v-if="showSwitch" @closeSwitch="closeswitchMenu"></switchMenu>
        <!-- 协议组件 -->
        <agreenment :isShowGreen="isShowAgreen" v-on:changeHidden="customHidden($event)"></agreenment>
        <!-- 远程引入组件 -->
        <remoteJS src="//cstaticdun.126.net/load.min.js">
        </remoteJS>
    </div>
</template>
<script>
import agreenment from "./children/agreenment.vue";
import loginMenu from "./children/loginMenu.vue";
import registMenu from "./children/registMenu.vue";
import switchMenu from "./children/switchMenu.vue";
import dialogBar from '../alert/alert.vue';
export default {
    components: {
        loginMenu,  // 登录
        registMenu, // 注册
        agreenment, // 协议
        switchMenu,//切换科目
        dialogBar,//弹窗
        remoteJS: {  // 验证码js
            render(createElement) {
                return createElement('script', { attrs: { type: 'text/javascript', src: this.src } });
            },
            props: {
                src: { type: String, required: true },
            },
        }
    },
    data: function() {
        return {
            isRegShow: true,
            registerType: 'regist',   // regist or restorePassword
//          showSubMenu: true,     // 显示登录true or 显示注册 false
            isShowAgreen: false, // 是否显示协议
            logoUrl:require('../../images/bg_logo.png'), //不同代理商的logo
            mianBgUrl:require('../../images/10.jpg'), //不同代理商的背景图
            showFoot:false,
            sendVal: false,
            showFlag:{
            	'module':'',
            	'type':'',
            	'title':'',
            	'area':[],
            },
            showSwitch:false,
        }
    },
    methods: {
        customHidden(msg) {
            // 改变协议隐藏变量值
            this.isShowAgreen = msg;
        },
        openswitchMenu(module,type,title,area){
        	this.showSwitch = true;
        	this.sendVal = false;
        },
        closeswitchMenu(){
        	this.showSwitch = false;
        },
        openMask(module,type,title,area){
            this.sendVal = true;
            this.showFlag={
            	'module':module,
            	'type':type,
            	'title':title,
            	'area':area
            }
        },
        changeShowSubMenu(index) {
            // 显示隐藏登录 or 注册
            var _that = this;
            if ((_that.showSubMenu && index === 0) || (!_that.showSubMenu && index === 1)) {
                return;
            }
            _that.showSubMenu = index === 1 ? false : true;
            if (!_that.showSubMenu) {
                _that.$refs.regChild.parengtChange(_that.showSubMenu);
            }
        },
        showlogo(){
        	var _that = this;
        	var agentCode = _that.$route.query.ac;
        	this.showFoot= true;
        	if (host === 'shipinbao.ksbao.com' || host === 'shipinbaot.ksbao.com') {
               this.logoUrl = require('../../images/bg_logo_spb.png');
            }else if(agentCode === '100329-1'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_100329-1.png');
            }else if(agentCode === '100561-1'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_100561-1.png');
            }else if(agentCode === '100398-1'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_100398-1.png');
            } else if(agentCode === '100054-1'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_100054-1.png');
            }else if(agentCode === '100416-1'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_100416-1.png');
            }else if(agentCode === '500001'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_500001.png');
            	document.getElementById('start_center').style.top = '40%';
                _that.$refs.bg_images.style.marginBottom = '200px';
                document.getElementById('start_bottom_img').style.display = 'block';
            }else if(agentCode === '077293'||agentCode==='077294'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_077293.png');
            	this.mianBgUrl = "url(" + require("../../images/bg_077293.png") + ")";
            }else if(agentCode === '077295'){
            	this.mianBgUrl = "url(" + require("../../images/bg_077295.png") + ")";
            }else if(agentCode === '300096-2'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_300096-2.png');
            }else if(agentCode === '101021-2'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_101021-2.png');
            }else if(agentCode === '076901'){
            	this.logoUrl = require('../../images/agentimg/076901/bg_logo.png');
            	document.title='博大考点';
            }else if(agentCode === '057303'){
            	this.logoUrl = require('../../images/agentimg/wzkaodian.png');
            	document.title = '贤仕考典';
            }else if(agentCode==='101600-1'||agentCode==='101601-1'||agentCode==='101602-1'){
            	this.logoUrl = require('../../images/agentimg/bishi_logo.png');
            }else if(host === 'www.kaiedu.com' || agentCode==='021028'){
            	this.logoUrl = require('../../images/agentimg/bg_logo_021028.png');
            	this.mianBgUrl = "url(" + require("../../images/bg_021028.png") + ")";
            	document.getElementById('start_center').style.top = '10%';
                document.getElementById('start_center').style.marginTop = '0px';
            }
            if(host === 'hzs.ksbao.com' || host === 'www.kaiedu.com' || host === 'byhzs.mytest.ink'){
            	if(agentCode!='500001'){
            		this.showFoot= false;
            	}
            }
            if(agentCode === '057303' || agentCode ==='021028'){
            	this.showFoot= false;
            } 
        },
        clickCancel(){
            console.log('点击了取消');
        },
        clickDanger(){
            console.log('这里是danger回调')
        },
        clickConfirm(){
            console.log('点击了confirm');
        },
        asd(){
        	console.log(';;;;;;')
        }
    },
    created: function() {
//      this.showlogo();
    },
    mounted: function() {
    	this.showlogo();
    }
}

</script>
<style lang="less">
@import "./login.less";
.yidun_intellisense--light .yidun_intelli-control {
    border-color: #ff9945!important;
    background: #fff!important;
    font-size: 16px!important;
    border-radius: 4px!important;
}

.yidun_intellisense--light .yidun_intelli-icon {
    display: none!important;
}

.yidun_intellisense--light .yidun_intelli-tips {
    color: #ff9945!important;
}
.weui-toast__content {
    color: #fff;
}

</style>
